package de.gora.prog2swing.adventskalender;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class AdventMenu extends JMenuBar{
	
	private static final long serialVersionUID = 1L;

	private JMenu
		file,
		quiz,
		info;
	
	private JMenuItem
		open,
		save,
		exit,
		neew,
		edit,
		delete,
		author,
		help;
		
	
	public AdventMenu(){
		//create JMenus
		this.file = new JMenu("Datei");
		this.quiz = new JMenu("Raetselfrage");
		this.info = new JMenu("Info");
		
		//create JMenuItems
		this.open = new JMenuItem("Oeffnen");
		this.save = new JMenuItem("Speichern");
		this.exit = new JMenuItem("Beenden");
		this.neew = new JMenuItem("Neu");
		this.edit = new JMenuItem("Bearbeiten");
		this.delete = new JMenuItem("Loeschen");
		this.author = new JMenuItem("Autor");
		this.help = new JMenuItem("Hilfe");
		
		//Bind ActionListeners
		this.exit.addActionListener(new AdventMenuAdapter());
		
		this.author.addActionListener(new AdventMenuAdapter());
		this.help.addActionListener(new AdventMenuAdapter());
		
		
		//Bind items to JMenus
		this.file.add(this.open);
		this.file.add(this.save);
		this.file.addSeparator();
		this.file.add(this.exit);
		
		this.quiz.add(this.neew);
		this.quiz.add(this.edit);
		this.quiz.add(this.delete);
		
		this.info.add(this.author);
		this.info.add(this.help);
		
		//Bind JMenus to JMenuBar
		this.add(this.file);
		this.add(this.quiz);
		this.add(this.info);
	}
	
}
